package com.guigu.controller;


import com.guigu.pojo.PurchaseOrderDetails;
import com.guigu.service.PurchaseOrderDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 采购单明细表 前端控制器
 * </p>
 *
 * @author Mr.Zhang
 * @since 2025-03-12
 */
@CrossOrigin
@RestController
@RequestMapping("/purchase-order-details")
public class PurchaseOrderDetailsController {

    @Autowired
    private PurchaseOrderDetailsService purchaseOrderDetailsService;

    @GetMapping("/{purchaseOrderNumber}")
    @ResponseBody
    public List<PurchaseOrderDetails> getAllPurchaseOrderDetailsByPurchaseOrderNumber(@PathVariable String purchaseOrderNumber) {
        System.out.println(purchaseOrderNumber);
        List<PurchaseOrderDetails> allPurchaseOrderDetailsByPurchaseOrderNumber = purchaseOrderDetailsService.getAllPurchaseOrderDetailsByPurchaseOrderNumber(purchaseOrderNumber);

        System.out.println(allPurchaseOrderDetailsByPurchaseOrderNumber);

        return allPurchaseOrderDetailsByPurchaseOrderNumber;
    }

}

